package com.example.example;


import com.example.config.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(NameException.class)
    public R exceptionHandler(NameException e){
        e.printStackTrace();
        return R.error(e.getMessage()+"已存在");
    }



    @ExceptionHandler(Exception.class)
    public R exceptionHandler(Exception e){
        e.printStackTrace();
        return R.error("目前访问人数过多");
    }
}
